package xcmg.device.infra.enums;

public enum PurchaseOrdTypeEnum {

    GROUP_ORDER("NB", 0, "普通采购订单"),
    COMMON_ORDER("Z04", 1, "集团采购订单");

    /**
     * 订单类型
     */
    private String orderType;

    /**
     * 集购零件标记：0对应普通零件，1对应集购零件
     */
    private Integer isGroupPur;

    /**
     * 描述
     */
    private String desc;

    PurchaseOrdTypeEnum(String orderType, Integer isGroupPur, String desc) {
        this.orderType = orderType;
        this.isGroupPur = isGroupPur;
        this.desc = desc;
    }


    /**
     * 根据订单类型获取是否集团采购订单
     * @param orderType
     * @return
     */
    public static Integer getGroupTypeByOrderType(String orderType) {
        for (PurchaseOrdTypeEnum ordTypeEnum : PurchaseOrdTypeEnum.values()) {
            if (ordTypeEnum.getOrderType().equals(orderType)) {
                return ordTypeEnum.getIsGroupPur();
            }
        }
        return null;
    }

    public String getOrderType() {
        return orderType;
    }

    public void setOrderType(String orderType) {
        this.orderType = orderType;
    }

    public Integer getIsGroupPur() {
        return isGroupPur;
    }

    public void setIsGroupPur(Integer isGroupPur) {
        this.isGroupPur = isGroupPur;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
